package com.example.medispider.pojo.detail.userinfo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import us.codecraft.webmagic.model.HttpRequestBody;

import java.util.HashMap;
import java.util.Map;

/**
 * 同时用于第一次响应和第二次请求
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class UserInfo {
    private String setlId;
    private String mdtrtId;
    private String initSetlId;
    private String psnNo;
    private String psnInsuRltsId;
    private String psnName;
    private String psnCertType;
    private String certno;
    private String gend;
    private String naty;
    private String brdy;
    private Double age;
    private String insutype;
    private String psnType;
    private String cvlservFlag;
    private String cvlservLv;
    private String spPsnType;
    private String spPsnTypeLv;
    private String clctGrde;
    private String flxempeFlag;
    private String nwbFlag;
    private String insuAdmdvs;
    private String empNo;
    private String empName;
    private String empType;
    private String econType;
    private String afilIndu;
    private String afilRlts;
    private String empMgtType;
    private String payLoc;
    private String fixmedinsCode;
    private String fixmedinsName;
    private String hospLv;
    private String fixBlngAdmdvs;
    private String lmtpricHospLv;
    private String dedcHospLv;
    private String begndate;
    private String enddate;
    private String setlTime;
    private String mdtrtCertType;
    private String medType;
    private String setlType;
    private String clrType;
    private String clrWay;
    private String clrOptins;
    private Double medfeeSumamt;
    private Double fulamtOwnpayAmt;
    private Double overlmtSelfpay;
    private Double preselfpayAmt;
    private Double inscpAmt;
    private Double dedcStd;
    private Double crtDedc;
    private Double actPayDedc;
    private Double hifpPay;
    private Double poolPropSelfpay;
    private Double hiAgreSumfee;
    private Double cvlservPay;
    private Double hifesPay;
    private Double hifmiPay;
    private Double hifobPay;
    private Double hifdmPay;
    private Double mafPay;
    private Double othfundPay;
    private Double fundPaySumamt;
    private Double psnPay;
    private Double acctPay;
    private Double cashPayamt;
    private Double ownpayHospPart;
    private String refdSetlFlag;
    private String calIptCnt;
    private String year;
    private String diseNo;
    private String diseName;
    private String invono;
    private String manlReimRea;
    private String midSetlFlag;
    private String acctUsedFlag;
    private String valiFlag;
    private String memo;
    private String rid;
    private String updtTime;
    private String crterId;
    private String crterName;
    private String crteTime;
    private String crteOptinsNo;
    private String opterId;
    private String opterName;
    private String optTime;
    private String optinsNo;
    private String poolareaNo;
    private String medinsSetlId;
    private String setlCashpayWay;
    private Double balc;
    private Double acctMulaidPay;
    private String psnSetlway;
    private String mdtrtCertNo;
    private String finAcenTime;
    private String payFailDesc;
    private String finDspoFlag;
    private String identifyAdmdvs;
    private Integer acctMulaidPay_yd;
    private String taskId;
    private String projectNo;
    private String staticData;
    private String cumulateData;
    private String feeInfo;
    private String psnTrtInfoDTOs;
    private String feeListFLHZDTOs;

    /**
     * 将对象转换为第二次请求的请求体（首次请求使用）
     */
    public HttpRequestBody toQueryString(int pageSize) {
        // 以下字段用于第二次请求
        int pageNum = 1;
        String _modulePartId_ = "";
        String frontUrl = "https://portal.hub.hsip.gov.cn/mbs/mbs-dy-420500-ui/N1407.html#/N140701";
        Map<String, Object> params = new HashMap<>();
        params.put("pageNum", pageNum);
        params.put("pageSize", pageSize);
        params.put("_modulePartId_", _modulePartId_);
        params.put("frontUrl", frontUrl);
        // 添加所有属性到params中
        params.put("setlId", this.setlId);
        params.put("mdtrtId", this.mdtrtId);
        params.put("initSetlId", this.initSetlId);
        params.put("psnNo", this.psnNo);
        params.put("psnInsuRltsId", this.psnInsuRltsId);
        params.put("psnName", this.psnName);
        params.put("psnCertType", this.psnCertType);
        params.put("certno", this.certno);
        params.put("gend", this.gend);
        params.put("naty", this.naty);
        params.put("brdy", this.brdy);
        params.put("age", this.age);
        params.put("insutype", this.insutype);
        params.put("psnType", this.psnType);
        params.put("cvlservFlag", this.cvlservFlag);
        params.put("cvlservLv", this.cvlservLv);
        params.put("spPsnType", this.spPsnType);
        params.put("spPsnTypeLv", this.spPsnTypeLv);
        params.put("clctGrde", this.clctGrde);
        params.put("flxempeFlag", this.flxempeFlag);
        params.put("nwbFlag", this.nwbFlag);
        params.put("insuAdmdvs", this.insuAdmdvs);
        params.put("empNo", this.empNo);
        params.put("empName", this.empName);
        params.put("empType", this.empType);
        params.put("econType", this.econType);
        params.put("afilIndu", this.afilIndu);
        params.put("afilRlts", this.afilRlts);
        params.put("empMgtType", this.empMgtType);
        params.put("payLoc", this.payLoc);
        params.put("fixmedinsCode", this.fixmedinsCode);
        params.put("fixmedinsName", this.fixmedinsName);
        params.put("hospLv", this.hospLv);
        params.put("fixBlngAdmdvs", this.fixBlngAdmdvs);
        params.put("lmtpricHospLv", this.lmtpricHospLv);
        params.put("dedcHospLv", this.dedcHospLv);
        params.put("begnddate", this.begndate);
        params.put("enddate", this.enddate);
        params.put("setlTime", this.setlTime);
        params.put("mdtrtCertType", this.mdtrtCertType);
        params.put("medType", this.medType);
        params.put("setlType", this.setlType);
        params.put("clrType", this.clrType);
        params.put("clrWay", this.clrWay);
        params.put("clrOptins", this.clrOptins);
        params.put("medfeeSumamt", this.medfeeSumamt);
        params.put("fulamtOwnpayAmt", this.fulamtOwnpayAmt);
        params.put("overlmtSelfpay", this.overlmtSelfpay);
        params.put("preselfpayAmt", this.preselfpayAmt);
        params.put("inscpAmt", this.inscpAmt);
        params.put("dedcStd", this.dedcStd);
        params.put("crtDedc", this.crtDedc);
        params.put("actPayDedc", this.actPayDedc);
        params.put("hifpPay", this.hifpPay);
        params.put("poolPropSelfpay", this.poolPropSelfpay);
        params.put("hiAgreSumfee", this.hiAgreSumfee);
        params.put("cvlservPay", this.cvlservPay);
        params.put("hifesPay", this.hifesPay);
        params.put("hifmiPay", this.hifmiPay);
        params.put("hifobPay", this.hifobPay);
        params.put("hifdmPay", this.hifdmPay);
        params.put("mafPay", this.mafPay);
        params.put("othfundPay", this.othfundPay);
        params.put("fundPaySumamt", this.fundPaySumamt);
        params.put("psnPay", this.psnPay);
        params.put("acctPay", this.acctPay);
        params.put("cashPayamt", this.cashPayamt);
        params.put("ownpayHospPart", this.ownpayHospPart);
        params.put("refdSetlFlag", this.refdSetlFlag);
        params.put("calIptCnt", this.calIptCnt);
        params.put("year", this.year);
        params.put("diseNo", this.diseNo);
        params.put("diseName", this.diseName);
        params.put("invono", this.invono);
        params.put("manlReimRea", this.manlReimRea);
        params.put("midSetlFlag", this.midSetlFlag);
        params.put("acctUsedFlag", this.acctUsedFlag);
        params.put("valiFlag", this.valiFlag);
        params.put("memo", this.memo);
        params.put("rid", this.rid);
        params.put("updtTime", this.updtTime);
        params.put("crterId", this.crterId);
        params.put("crterName", this.crterName);
        params.put("crteTime", this.crteTime);
        params.put("crteOptinsNo", this.crteOptinsNo);
        params.put("opterId", this.opterId);
        params.put("opterName", this.opterName);
        params.put("optTime", this.optTime);
        params.put("optinsNo", this.optinsNo);
        params.put("poolareaNo", this.poolareaNo);
        params.put("medinsSetlId", this.medinsSetlId);
        params.put("setlCashpayWay", this.setlCashpayWay);
        params.put("balc", this.balc);
        params.put("acctMulaidPay", this.acctMulaidPay);
        params.put("psnSetlway", this.psnSetlway);
        params.put("mdtrtCertNo", this.mdtrtCertNo);
        params.put("finAcenTime", this.finAcenTime);
        params.put("payFailDesc", this.payFailDesc);
        params.put("finDspoFlag", this.finDspoFlag);
        params.put("identifyAdmdvs", this.identifyAdmdvs);
        params.put("acctMulaidPay_yd", this.acctMulaidPay_yd);
        params.put("taskId", this.taskId);
        params.put("projectNo", this.projectNo);
        params.put("staticData", this.staticData);
        params.put("cumulateData", this.cumulateData);
        params.put("feeInfo", this.feeInfo);
        params.put("psnTrtInfoDTOs", this.psnTrtInfoDTOs);
        params.put("feeListFLHZDTOs", this.feeListFLHZDTOs);
        // 处理null值，将null转换为空字符串
        for (Map.Entry<String, Object> entry : params.entrySet()) {
            if (entry.getValue() == null) {
                params.put(entry.getKey(), "");
            }
        }

        HttpRequestBody httpRequestBody = HttpRequestBody.form(params, "utf-8");
        return httpRequestBody;
    }
}
